#pragma once

#include <iostream>
#include <string>
#include "InitAddr.hpp"

class Reactor;

class Connection
{
public:
    Connection()
    {

    }

    virtual void Recver()
    {
        std::cout << "Connection Recver" << std::endl;
    }

    virtual void Sender()
    {
        std::cout << "Connection Sender" << std::endl;
    }

    virtual void Exceptor()
    {
        std::cout << "Connection Exceptor" << std::endl;
    }

    uint32_t GetEvents()
    {
        return _events;
    }

    void SetEvent(const uint32_t& events)
    {
        _events = events;
    }

    void SetFd(int sockfd)
    {
        _sockfd = sockfd;
    }

    int GetFd()
    {
        return _sockfd;
    }

    void SetOwner(Reactor* owner)
    {
        _owner = owner;
    }

    Reactor* GetOwner()
    {
        return _owner;
    }

    ~Connection()
    {

    }
private:
    int _sockfd;

    //关心事件
    uint32_t _events;

    //再添加一个回指指针
    Reactor* _owner;
};